<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="recording and transcoding system">
    <meta name="author" content="typefo">
    <link rel="icon" href="favicon.ico">
    <title>pbxMon System</title>
    <link type="text/css" rel="stylesheet" href="/css/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link type="text/css" rel="stylesheet" href="/css/all.css">
    <link type="text/css" rel="stylesheet" href="/css/flat/blue.css">
    <link type="text/css" rel="stylesheet" href="/css/system.css">
  </head>
  <body>
    <nav class="navbar navbar-default navbar-static-top">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand">
            <img alt="Brand" src="/img/logo.png" width="34" style="margin-top:-8px" />
          </a>
          <a class="navbar-brand">pbxMon</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li><a href="/cdr">通话记录</a></li>
            <li><a href="/server">网关管理</a></li>
            <li><a href="/route">路由管理</a></li>
            <li><a href="/interface">接口管理</a></li>
            <li><a href="/report">数据报表</a></li>
            <li><a href="/system/status">服务器状态</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="/system/option"><span class="glyphicon glyphicon-cog"></span> 系统设置</a></li>
            <li><a href="/logout"><span class="glyphicon glyphicon-log-out"></span> 退 出</a></li>
          </ul>
        </div>
      </div>
    </nav>
    <div class="container">
      <div class="row">
        <ol class="breadcrumb">
          <li><a href="/cdr">Home</a></li>
          <li><a href="#">System</a></li>
          <li class="active">Option</li>
          <li class="pull-right help"><span class="glyphicon glyphicon-question-sign"></span> <a href="#">帮助信息</a></li>
        </ol>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <ul class="nav nav-tabs">
          <li role="presentation" class="active"><a href="/system/option">常规选项</a></li>
          <li role="presentation"><a href="/system/security">防火墙</a></li>
          <li role="presentation"><a href="/system/password">修改密码</a></li>
          <li role="presentation"><a href="/system/about">关于系统</a></li>
        </ul>
      </div>
      <div class="row box">
        <div class="checkbox">
          <label>
             <input id="record" type="checkbox"<?php echo isset($config['record']) && intval($config['record']) === 1 ? 'checked="checked"' : ''; ?>> Enable call recording - all gateway for global
          </label>
        </div>
        <div class="checkbox disabled">
          <label>
            <input id="blacklist" type="checkbox"<?php echo isset($config['blacklist']) && intval($config['blacklist']) === 1 ? 'checked="checked"' : ''; ?>disabled="disabled"> Enable phone blacklist filtering
          </label>
        </div>
        <div class="checkbox">
          <label>
            <input id="security" type="checkbox"<?php echo isset($config['security']) && intval($config['security']) === 1 ? 'checked="checked"' : ''; ?>> Enable Web firewall security policy
          </label>
        </div>
        <hr />
        <div>
          <p><small class="text-muted"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> After the recording function is enabled, you need to reload the route configuration file</small></p>
        </div>
      </div>
    </div>
  </body>
  <script type="text/javascript" src="/js/jquery.min.js"></script>
  <script type="text/javascript" src="/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="/js/layer.js"></script>
  <script type="text/javascript" src="/js/icheck.min.js"></script>
  <script type="text/javascript">
  $(document).ready(function(){
    $('input').iCheck({
        checkboxClass: 'icheckbox_flat-blue',
        radioClass: 'iradio_flat-blue',
        increaseArea: '20%'
      });
  });

  $('input').on('ifChanged', function(event){
    var url = '/system/option?';
    
    switch (this.id) {
      case 'record':
        url += 'key=record&val=' + (this.checked ? '1' : '0');
        break;
      case 'blacklist':
        url += 'key=blacklist&val=' + (this.checked ? '1' : '0');
        break;
      case 'security':
        url += 'key=security&val=' + (this.checked ? '1' : '0');
        break;
    }

    $.get(url, function(response, status){
      if (status == 'success') {
        window.location.reload();
      } else {
        layer.msg('Oops, 开启 ' + this.id + ' 失败!', {icon: 2});
      }
    });
  });

  </script>
</html>
